// 深度优先遍历遍历json中所有值

const jsonTs = {
  a:{b:{c:1}},
  d:[1,2],
}

const dfsTs = (node:any, path:Array<number>=[]) => {
  console.log(node, path)
  Object.keys(node).forEach(key => {
    dfsTs(node[key], path.concat(key as never))
  })
}

dfsTs(jsonTs, [])